type Toptions_Pinput = Toptions_CVP & {
};

@ACdisabled
@ACreadonly
@AConchange
@ACcontrols
@ACname
@ACvalue
class Pinput extends _CVP_<Toptions_Pinput> {
    // ====================================================== 当前控件特殊实现 ====================================================== //
    // @ts-ignore Property 'container' has no initializer and is not definitely assigned in the constructor.ts(2564)
    private container: KHTMLElement;

    // ====================================================== 初始化参数 ====================================================== //
    static defaultOptions: Toptions_Pinput = {
    };
    protected override options_default(): Toptions_Pinput {
        return Pinput.defaultOptions;
    }
    protected override options_handlers(): Toptions_handlers<Toptions_Pinput> {
        return {
        };
    }
    protected override overloading_mapping(mapping: Toption_key_to_types_mapping<Toptions_Pinput>): Toverloading_mapping<Toptions_Pinput> {
        return [
        ];
    }
    protected override options_checker(options: Toptions_Pinput): void {
    }

    // ====================================================== 创建实例对象 ====================================================== //
    protected override initializer(): void {
        this.container = this.ele.createElement('div').addClass('container');
    }
    protected override afterInitializer(): void {
    }

    // ====================================================== 创建值控件实例对象 ====================================================== //
    protected override item_render(value: any): HTMLElement {
        return U.D.createElement('input')
            .addClass(_CP_.CLASSES.INPUTER)
            .setAttr('type', 'input')
            .insertTo(this.container).ele()!;
    }
    public override getValue(): any {
        return (this.item as HTMLInputElement).value;
    }
    public override setValue(value: any): void {
        (this.item as HTMLInputElement).value = (value === DEFAULT ? '' : value);
    }
    public override disable(): void {
        (this.item as HTMLInputElement).disabled = true;
    }
    public override enable(): void {
        (this.item as HTMLInputElement).disabled = false;
    }
    public override readonly(): void {
        (this.item as HTMLInputElement).readOnly = true;
    }
    public override editable(): void {
        (this.item as HTMLInputElement).readOnly = false;
    }
}

interface _IK_ {
    // ========= 创建实例对象（通用） ========= //
    /**
     * 创建控件
     * @returns 控件实例对象
     */
    input(): KHTMLElement;

    /**
     * 创建控件
     * @param options 控件参数
     * @returns 控件实例对象
     */
    input(options: Toptions_Pinput): KHTMLElement;

    // ========= 创建实例对象（值控件） ========= //
    /**
     * 创建控件
     * @param value 值
     * @returns 控件实例对象
     */
    input(value: Toptions_VALUE$value): KHTMLElement;
}
{
    K.input = (...args: Array<any>) => { return new Pinput(...args).ele; };
}
